<?php !defined("IN_SYSTEM") && exit("ACCESS DENY");?>
{template header}
{template top}
<div id="uc">
{template uc/left}
<div id="uc_main">
	<div class="uc_tab">
	<ul>
		<li>{if !$action}<span class="on">基本资料</span>{else}<a href="{url('home.php?f=sprofile')}">基本资料</a>{/if}</li>
		<li>{if $action == 'password'}<span class="on">修改密码</span>{else}<a href="{url('home.php?f=sprofile&a=password')}">修改密码</a>{/if}</li>
	</ul>
	</div>
	
	<div id="uc_contain">
	{if !$action}
		<form name="user_add" method="post" action="{url('home.php?f=sprofile&a=save')}"  enctype="multipart/form-data">
		<input type="hidden" id="rid" value="{$result['rid']}" name="rid"/>
    	<input type="hidden" name="street1" value="{$result['addr2']}" id="street1"/>
	<table cellspacing="0" class="uc_fa_table">
		<tr>
			<td colspan="6" ><img src="{if $result['logo']}{DATA_DIR}{$result['logo']}{else}static/images/avatar.jpg{/if}" style="float:left;margin-right:5px;"></img>
			<a href="javascript:;" >上传商家logo:</a><br/>
			<input type="file" name="avatar" id="avatar" size="18"/><br/>
			<span class="uc_tips">{$lang['avatar_size_desc']}</span>
			</td>
			
			
		</tr>
		<tr>
			<td class="td1">商家名称：</td>
			<td colspan="3"><input type="text" name="shopname" class="input" value="{$result['shopname']}" size="57" /></td>
		
		</tr>
		<tr>
			<td class="td1" >经营类型：</td>
			<td colspan="3" >
			<select name="stype" id="stype" >
			{loop $cates $cate}
			<option value="{$cate['cid']}" {if $cate['cid']== $result['cid']}selected{/if}>{$cate['catename']}</option>
			{/loop}
			</select>
			</td>
		</tr>
		<tr>
			<td class="td1" >外卖时间：</td>
			<td colspan="3" >
			从
			<select name="opentime" id="opentime">
			{loop $worktime1 $k $w}
			<option value="{$k}" {if $k==$result['opentime']}selected{/if}>{$w}</option>
			{/loop}
			</select>
			到
			<select name="closetime" id="closetime">
			{loop $worktime2 $k $w}
			<option value="{$k}" {if $k==$result['closetime']}selected{/if}>{$w}</option>
			{/loop}
			</select>
			<input type="checkbox" value="1" {if $result['sat']}checked{/if} name="res1">周六休息</input>
			<input type="checkbox" value="1" {if $result['sun']}checked{/if} name="res2">周日休息</input>
			</td>
		</tr>
		<tr>
			<td class="td1">订餐电话：</td>
			<td  colspan="3"><input type="text" name="tel" class="input" value="{$result['tel']}" size="57" /></td>
		
		</tr>
		<tr>
			<td  class="td1">外送条件：</td>
			<td  colspan="3"><select name="minnum" id="minnum">
			{php $minarray = range(1,9)}
			{loop $minarray $min}
			<option value="{$min}" {if $min==$result['minnum']}selected{/if}>{$min} 份</option>
			{/loop}
			</select> 起送，<span title="消费至少要满多少钱才送">起送价</span><input type="text" name="minprice" class="input" size="6" value="{$result['minprice']}" />元，<span title="外送费用">外送费</span><input type="text" name="extprice" class="input" size="6" value="{$result['extprice']}" />元</td>
		</tr>
		<tr>
			<td class="td1" >所属地区：</td>
			<td colspan="3" >{$region}</td>
		</tr>
		<tr>
			<td class="td1">详细地址：</td>
			<td colspan="3"><span id="address">{$result['addr2']}</span><input type="text" name="addr1" class="input" size="30" value="{$result['addr1']}" /></td>
		</tr>
		
		<tr>
			<td class="td1">公交线路：</td>
			<td colspan="3"><input type="text" name="bus" class="input" size="57" value="{$result['bus']}" /></td>
		</tr>
		<tr>
			<td class="td1" valign="top">餐厅描述：</td>
			<td colspan="3"><textarea name="description" cols="56" rols="4">{$result['description']}</textarea>
		</tr>
		<tr>
			<td class="td1" valign="top">餐厅承诺：</td>
			<td colspan="3"><textarea name="chengnuo" cols="56" rols="4">{$result['chengnuo']}</textarea>
		</tr>
		<tr>
			<td class="td1" valign="top">餐厅特点：</td>
			<td colspan="3"><textarea name="tedian" cols="56" rols="4">{$result['tedian']}</textarea>
		</tr>
		<tr class="bg2"><td class="td1"></td><td colspan="3"><input type="submit" class="button" value="保存" /> </td></tr>
	</table>
	</form>
	<script type="text/javascript">
			function region(obj,le){
				var val=$(obj).val();
				if(val<1 && le>0 && $("#level"+(le-1)).val() >0){
					$("#rid").val($("#level"+(le-1)).val());
				}else{
					$("#rid").val(val);
				}
				var ht='';
				var lev=le;
				if(val<1){
					lev=lev-1;
					if(lev<1){
						$('#address').html("");
						$('#street1').val("");
					}
				}
				for(var i=1;i<=lev;i++){
						ht=ht+$("#level"+i).find("option:selected").text();
						$('#address').html(ht);
						$('#street1').val(ht);
				}
				if($(obj).val()<1){
					$('#level'+(le+1)).remove();
					$('#level'+(le+2)).remove();
					$('#level'+(le+3)).remove();
					return ;
				}
				$.getJSON('home.php?m=addr&f=ajax&id='+$(obj).val()+'&tm='+Math.random(),'',function(data){
					if(data.status==true){
						$('#level'+(le+1)).remove();
						$('#level'+(le+2)).remove();
						$('#level'+(le+3)).remove();
						$(data.data).insertAfter($('#level'+le));
					}else{
					}
					});
			}
			</script>
	{/if}
	{if $action == 'password'}
		<form method="post" action="{url('home.php?f=profile&a=password')}">
	<input type="hidden" name="uid" value="{$result['uid']}" />
	<table cellspacing="0" class="sub">
		<tr>
			<td colspan="2"><div id="tip"></div></td>
		</tr>
		{if !$reset}
		<tr>
			<td align="right">原密码：</td>
			<td><input type="text" name="oldpassword" class="input" size="40" value="" /></td>
		</tr>
		{/if}
		<tr>
			<td align="right">新密码：</td>
			<td><input type="text" name="password" class="input" size="40" value="" /></td>
		</tr>
		<tr>
			<td align="right">确认新密码：</td>
			<td><input type="text" name="repassword" class="input" size="40" value="" /></td>
		</tr>
		<tr class="bg2"><td></td><td><input type="submit" class="button" value="保存" /> </td></tr>
		</table>
		</form>
	{/if}
	
	</div>
</div>
</div>
{template footer}